package search;

import java.util.ArrayList;
import java.util.Date;



import java.io.Serializable;


/**
 * represent the data in one row of search result
 * @author ran
 *
 */
public class SearchTuple implements Serializable{
	
	private static final long serialVersionUID = 1L;
	private String fileName;
	private ArrayList<String> tags= new ArrayList<String>();
	private String boxName;
	private int size;
	private Date lastModify;
	//getters and setters
	public String getBoxName() {
		return boxName;
	}
	public void setBoxName(String boxName) {
		this.boxName = boxName;
	}
	public int getSize() {
		return size;
	}
	public void setSize(int size) {
		this.size = size;
	}
	public Date getLastModify() {
		return lastModify;
	}
	public void setLastModify(Date date) {
		this.lastModify = date;
	}
	public String getFileName() {
		return fileName;
	}
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
	public ArrayList<String> getTags() {
		return tags;
	}
	public void addTags(String tag) {
		this.tags.add(tag);
	}
	/**
	 * put all data in array of string
	 * @return array of string with all data
	 */
	public String[] toArray(){
		String arr[]=new String[]{fileName,boxName,Integer.toString(size),lastModify.toString()};
		return arr;
	}
	@Override
	public String toString() {
		StringBuffer line = new StringBuffer();
		for(int i=0;i<tags.size();i++){
			line.append(tags.get(i));
			if(i!=tags.size()-1)
				line.append(',');
		}
		return line.toString();
	}
}